/**
 * @author 熊莎
 * @module 路由配置
 * @date   2020-5-22
 */

import React, { Suspense, lazy } from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';

class Router extends React.Component {
  render() {
    return (
      <BrowserRouter>
        <Suspense fallback={<div>Loading...</div>}>
          <Switch>
            <Route exact path="/login" component={lazy(() => import('@src/pages/Login/index'))} />
            <Route exact path="/yzm/:phone/:key" component={lazy(() => import('@src/pages/Yzm/index'))} />
            <Route exact path="/orderConfirm" component={lazy(() => import('@src/pages/OrderConfirm/index'))} />
            <Route exact path="/pay" component={lazy(() => import('@src/pages/Pay/index'))} />
            <Route exact path="/appointment/:tag/:time" component={lazy(() => import('@src/pages/Appointment/index'))} />
            <Route exact path="/appointmentNew/:id" component={lazy(() => import('@src/pages/AppointmentNew/index'))} />
            <Route exact path="/orderDetail/:id" component={lazy(() => import('@src/pages/OrderDetail/index'))} />
            <Route exact path="/recharge" component={lazy(() => import('@src/pages/Recharge/index'))} />
            <Route exact path="/balance" component={lazy(() => import('@src/pages/Balance/index'))} />
            <Route exact path="/vip" component={lazy(() => import('@src/pages/Vip/index'))} />
            <Route exact path="/vip/detail/:id" component={lazy(() => import('@src/pages/VipDetail/index'))} />
            <Route exact path="/vip/list" component={lazy(() => import('@src/pages/VipList/index'))} />
            <Route exact path="/test" component={lazy(() => import('@src/pages/Test/index'))} />
            <Route exact path="/:name?" component={lazy(() => import('@src/pages/Home/index'))} />
          </Switch>
        </Suspense>
      </BrowserRouter>
    );
  }
}

export default Router;
